﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Atleti.aspx.cs" Inherits="Autenticazione.Atleti" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href=Stile.css rel=Stylesheet type="text/css"></link>
</head>
<body>
    <form id="form1" runat="server">
        <div id="dvTop" style="height: 200px; border: 1px" align="center">
            <table width="100%">
                <tr style="height: 50px">
                    <td>&nbsp;</td>
                </tr>
                <tr style="height: 100px">
                    <td align="center">
                        <table>
                            <tr>
                                <td class="lblTitleHRef"><a href="Autenticazione.aspx">Login</a></td>
                                <td class="lblTitleHRef"><a href="Club.aspx">Club</a></td>
                                <td class="lblTitleHRef"><a href="Coaches.aspx">Allenatori</a></td>
                                <td class="lblTitleNotHRef">Atleti</td>
                                <td class="lblTitleHRef"><a href="Iscrizioni.aspx">Iscrizioni</a></td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr style="height: 50px">
                    <td>&nbsp;</td>
                </tr>
            </table>
        </div>
        <table id="tblAtleti" border="0px" width="100%">
            <tr>
                <td colspan="2" align="right">
                    <asp:Label ID="msgLoggedUser" runat="server" CssClass="lblLoggedUser" Text=""></asp:Label>&nbsp;|&nbsp;<a href="Logout.aspx">Logout</a>
                </td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Label ID="lblHelpNuovoCoach" runat="server" CssClass="lblInfo" Text="Per inserire nuovi atleti cliccare sul link <B><I><U>Aggiungi atleta</U></I></B>"></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Label ID="msgHelpIscrizioni" runat="server" CssClass="lblInfo" Text="Per modificare i dati relativi agli atleti cliccare sul pulsante matita (<img src=image/edit.gif border=0>), modificare i dati desiderati dopodichè cliccare sul pulsante memorizza (<img src=image/save.png border=0>). Per cancellare un atleta premere il simbolo (<img src=image/delete.gif border=0>)"></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Label ID="Label1" runat="server" CssClass="lblInfo" Text="Una volta inseriti gli Atleti, premere su Iscrizioni per iscrivere gli atleti alle diverse discipline."></asp:Label>
                </td>
            </tr>
            <tr>
                <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <table width="90%" border="0px">
                    <tr>
                        <td align="left">
                            <a href="#" onclick="Navigate()">Aggiungi atleta</a>
                        </td>
                    </tr>
                    <tr>
                    <td align="left">
                    <asp:DataGrid runat="server" ID="dtgAtleta" Width="100%" AutoGenerateColumns="false"
                    PageSize='<%# Autenticazione.Tools.Tools.GetMaxItemsForPage()%>' AllowPaging="true" AllowCustomPaging="true" DataKeyField="Id" AllowSorting="false"
                    OnEditCommand="dtgAtleta_Edit" OnItemDataBound="dtgAtleta_ItemDataBound" OnCancelCommand="dtgAtleta_Cancel" OnDeleteCommand="dtgAtleta_Delete"
                        OnUpdateCommand="dtgAtleta_Update" 
                        onpageindexchanged="dtgAtleta_SelectedIndexChanged" GridLines="Horizontal">
                    <AlternatingItemStyle BackColor="#CCCCCC" />
                    <Columns>
                       <asp:ButtonColumn Text="&lt;img src=image/Delete.gif border=0 title='Cancella atleta'&gt;" CommandName="Delete">
												<HeaderStyle Width="5%"></HeaderStyle>
											</asp:ButtonColumn>
                        <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="&lt;img src=image/save.png border=0 title='Memorizza'&gt;" CancelText="&lt;img src=image/undo.png border=0 title='Abbandona'&gt;" EditText="&lt;img src=image/edit.gif border=0 title='Modifica dati'&gt;">
												<HeaderStyle Width="5%"></HeaderStyle>
											</asp:EditCommandColumn>
                        <asp:TemplateColumn HeaderText="Atleta">
                            <ItemTemplate><%# DataBinder.Eval(Container.DataItem, "FullName") %></ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" MaxLength="50" ID="edit_Atleta" AutoPostBack="false" Text=<%# DataBinder.Eval(Container.DataItem, "FullName") %>></asp:TextBox>
                                <asp:RequiredFieldValidator ID="ReqAtleta" ControlToValidate="edit_Atleta" runat="server" 
                                    Display="Dynamic" CssClass="err" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Sesso">
                            <ItemTemplate>
                                <%#  GetGender(DataBinder.Eval(Container.DataItem, "Gender"))%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList Height="18px" Width="100px" runat="server" id="edit_Gender" />
							</EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Nascita">
                            <ItemTemplate>
                                <%# GetBirthDay(DataBinder.Eval(Container.DataItem, "BirthDay")) %>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList runat="server" AutoPostBack="true" ID="edit_BirthMonth" OnSelectedIndexChanged="BirthMonth_Changed" />/<asp:DropDownList runat="server" ID="edit_BirthYear" AutoPostBack="true" OnSelectedIndexChanged="BirthYear_Changed" />/<asp:DropDownList runat="server" ID="edit_BirthDay" />
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Cintura">
                            <ItemTemplate>
                                <%# GetBeltDescription(DataBinder.Eval(Container.DataItem, "Belt"))%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList runat="server" AutoPostBack="true" OnSelectedIndexChanged="Belt_Changed" ID="edit_Belt" />
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                         <asp:TemplateColumn HeaderText="Peso">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "Weight")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" ID="edit_Weight" Text=<%# DataBinder.Eval(Container.DataItem, "Weight") %> />
                                <asp:RequiredFieldValidator ID="ReqWeight" ControlToValidate="edit_Weight" runat="server" 
                                    Display="Dynamic" CssClass="err" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegExprWeight" runat="server" 
                                    ErrorMessage="Inserisci un numero (es. 69,50)" Display="Dynamic" CssClass="err" ControlToValidate="edit_Weight" ValidationExpression="[+]?[0-9]+(,[0-9]+)?">
                                    </asp:RegularExpressionValidator>
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Grappling Level">
                            <ItemTemplate>
                                <%# DataBinder.Eval(Container.DataItem, "GrapplingLevel")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                                <asp:DropDownList runat="server" AutoPostBack="true" OnSelectedIndexChanged="Grappling_Changed" ID="ddl_Grappling" />
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Match Full Contact">
                            <ItemTemplate><label id="lblGDMatchFC" runat="server"><%# DataBinder.Eval(Container.DataItem, "MatchFullContact") %></label></ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" ID="edit_MatchFullContact" Text=<%# DataBinder.Eval(Container.DataItem, "MatchFullContact") %>></asp:TextBox>
                                <asp:RequiredFieldValidator ID="ReqMatchFC" ControlToValidate="edit_MatchFullContact" runat="server" 
                                    Display="Dynamic" CssClass="err" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegMatchFC" runat="server" 
                                    ErrorMessage="Inserisci un numero" Display="Dynamic" CssClass="err" ControlToValidate="edit_MatchFullContact" ValidationExpression="[0-9]+">
                                    </asp:RegularExpressionValidator>
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Match Low Kick">
                            <ItemTemplate><label id="lblGDMatchLK" runat="server"><%# DataBinder.Eval(Container.DataItem, "MatchLowKick") %></label></ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" ID="edit_MatchLowKick" Text=<%# DataBinder.Eval(Container.DataItem, "MatchLowKick") %>></asp:TextBox>
                                <asp:RequiredFieldValidator ID="ReqMatchLK" ControlToValidate="edit_MatchLowKick" runat="server" 
                                    Display="Dynamic" CssClass="err" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegMatchLC" runat="server" 
                                    ErrorMessage="Inserisci un numero" Display="Dynamic" CssClass="err" ControlToValidate="edit_MatchLowKick" ValidationExpression="[0-9]+">
                                    </asp:RegularExpressionValidator>
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                        <asp:TemplateColumn HeaderText="Match K1 Rules">
                            <ItemTemplate><label id="lblGDMatchKR" runat="server"><%# DataBinder.Eval(Container.DataItem, "MatchK1Rules") %></label></ItemTemplate>
                            <EditItemTemplate>
                                <asp:TextBox runat="server" ID="edit_MatchK1Rules" Text=<%# DataBinder.Eval(Container.DataItem, "MatchK1Rules") %>></asp:TextBox>
                                <asp:RequiredFieldValidator ID="ReqMatchKR" ControlToValidate="edit_MatchK1Rules" runat="server" 
                                    Display="Dynamic" CssClass="err" ErrorMessage="(*)"></asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="RegMatchKR" runat="server" 
                                    ErrorMessage="Inserisci un numero" Display="Dynamic" CssClass="err" ControlToValidate="edit_MatchK1Rules" ValidationExpression="[0-9]+">
                                    </asp:RegularExpressionValidator>
                            </EditItemTemplate>
                        </asp:TemplateColumn>
                    </Columns>
                    <EditItemStyle BackColor="Black" ForeColor="White" />
                    <FooterStyle BackColor="#666666" />
                    <HeaderStyle BackColor="#666666" Font-Bold="True" Font-Size="Small" />
                    <ItemStyle BackColor="White" ForeColor="Black" Font-Size="Small" />
                    <PagerStyle VerticalAlign="Middle" Visible="true" HorizontalAlign="Center" 
                            NextPageText="&gt;" PrevPageText="&lt;" Mode="NumericPages" PageButtonCount="5"
                            BackColor="#979797" ForeColor="Black" Wrap="False" Font-Size="Small">
                    </PagerStyle>
                    </asp:DataGrid>
                </td>
                </tr>
                </table>
                </td>
            </tr>
        </table>
    <script type="text/javascript">
        function Navigate() {
            javascript: window.open('Atleta.aspx', '', 'top=144,left=144,width=500,height=500,toolbar=0,menubar=0');
        }

        function Aggiorna() {
            javascipt: window.open('Atleti.aspx', '_self');
        }
    </script>
    </form>
    </body>
</html>
